//
//  YPopTipView.h
//  yuikemall
//
//  Created by yuike6 yuike6 on 12-2-15.
//  Copyright (c) 2012年 yuike. All rights reserved.
//

/*
     Example 1 - point at a UIBarButtonItem in a nav bar:
     
     - (void)showPopTipView {
     NSString *message = @"Start by adding a waterway to your favourites.";
     YPopTipView *popTipView = [[YPopTipView alloc] initWithMessage:message];
     popTipView.delegate = self;
     [popTipView presentPointingAtBarButtonItem:self.navigationItem.rightBarButtonItem animated:YES];
     
     self.myPopTipView = popTipView;
     [popTipView release];
     }
     
     - (void)dismissPopTipView {
     [self.myPopTipView dismissAnimated:NO];
     self.myPopTipView = nil;
     }
     
     
     #pragma mark YPopTipViewDelegate methods
     - (void)popTipViewWasDismissedByUser:(YPopTipView *)popTipView {
     self.myPopTipView = nil;
     }
     
     Example 2 - pointing at a UIButton:
     
     - (IBAction)buttonAction:(id)sender {
     // Toggle popTipView when a standard UIButton is pressed
     if (nil == self.roundRectButtonPopTipView) {
     self.roundRectButtonPopTipView = [[[YPopTipView alloc] initWithMessage:@"My message"] autorelease];
     self.roundRectButtonPopTipView.delegate = self;
     
     UIButton *button = (UIButton *)sender;
     [self.roundRectButtonPopTipView presentPointingAtView:button inView:self.view animated:YES];
     }
     else {
     // Dismiss
     [self.roundRectButtonPopTipView dismissAnimated:YES];
     self.roundRectButtonPopTipView = nil;
     }	
     }
     
     #pragma mark YPopTipViewDelegate methods
     - (void)popTipViewWasDismissedByUser:(YPopTipView *)popTipView {
     // User can tap YPopTipView to dismiss it
     self.roundRectButtonPopTipView = nil;
     }
 */
#import "header.h"
typedef enum {
	PointDirectionUp = 0,
	PointDirectionDown
} PointDirection;

typedef enum {
    YPopTipAnimationSlide = 0,
    YPopTipAnimationPop
} YPopTipAnimation;


@protocol YPopTipViewDelegate;

@interface YPopTipView : UIViewEx
{
    UIColor					*backgroundColor_;
    id<YPopTipViewDelegate>	delegate_;
    
    NSString				*message_;
    id						targetObject_;
    
    UIColor					*textColor_;
    UIFont					*textFont_;
    
    YPopTipAnimation        animation_;
    CGSize					bubbleSize;
    
    CGFloat					cornerRadius;
    BOOL					highlight;
    
    CGFloat					sidePadding;
    CGFloat					topMargin;
    
    PointDirection			pointDirection_;
    CGFloat					pointerSize_;
    
    CGPoint					targetPoint_;
    
    UIView	                *customView_;
}

@property (nonatomic, retain)			UIColor					*backgroundColor;
@property (nonatomic, assign)		id<YPopTipViewDelegate>	delegate;

@property (nonatomic, assign)			BOOL					disableTapToDismiss;
@property (nonatomic, retain)			NSString				*message;

@property (nonatomic, retain)           UIView	                *customView;
@property (nonatomic, retain/*, readonly*/)	id						targetObject;

@property (nonatomic, retain)			UIColor					*textColor;
@property (nonatomic, retain)			UIFont					*textFont;

@property (nonatomic, assign)			UITextAlignment			textAlignment;
@property (nonatomic, assign)           YPopTipAnimation       animation;

@property (nonatomic, assign)           CGFloat                 maxWidth;
@property (nonatomic, assign)           PointDirection                 pointDirection;

@property (nonatomic, assign)           CGPoint                 targetPoint;
@property (nonatomic, assign)           CGFloat                 pointerSize;



- (id)initWithMessage:(NSString *)messageToShow;
- (id)initWithCustomView:(UIView *)aView;

- (void)presentPointingAtView:(UIView *)targetView inView:(UIView *)containerView animated:(BOOL)animated;
- (void)presentPointingAtBarButtonItem:(UIBarButtonItem *)barButtonItem animated:(BOOL)animated;

- (void)presentPointingAtPoint:(CGPoint )point inView:(UIView *)containerView animated:(BOOL)animated;
- (void)dismissAnimated:(BOOL)animated;

- (PointDirection) getPointDirection;
@end

@protocol YPopTipViewDelegate <NSObject>
- (void)popTipViewWasDismissedByUser:(YPopTipView *)popTipView;
@end
